package day19.pack9;

/*
锁的类型：
   排他锁/写锁  一个线程读写数据的时候，其他线程不允许读写
   共享锁/读锁
   公平锁
   非公平锁
   可重入锁   获取锁之后，再获取新的锁

 */
public class Test {
    public static void main(String[] args) {
        Station station = new Station();
        Runnable readThread = () -> {
            while(true) {
                station.getCount();
            }
        };
        Runnable writerThread = () -> {
            for (int i = 0; i < 50; i++) {
                station.sell();
            }
        };

        new Thread(readThread, "读1").start();
        new Thread(readThread, "读2").start();
        new Thread(writerThread, "写1").start();
        new Thread(writerThread, "写2").start();
        new Thread(writerThread, "写3").start();



    }
}
